package com.example.springcloudwinter.controller;

import com.example.springcloudwinter.dto.ResultEntity;
import com.example.springcloudwinter.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
@RequestMapping("/food")
public class FoodController {
    
    @Autowired
    private FoodService foodService;
    
    @GetMapping("/{businessId}")
    public ResultEntity<?> listFoodByBusinessId(@PathVariable("businessId") Integer
                                                        businessId) throws Exception{
        return foodService.listFoodByBusinessId(businessId);
    }
}
